package com.wantup.consumer.service.impl;

import common.bean.UserAddress;
import common.service.OrderService;
import common.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author Zhaoluowei
 * @version 1.0
 * @date 日期 2019/4/10 11:36
 * <p>
 * 现在这个是消费者
 * 创建订单需要 调用 用户的地址接口(需要调用别的项目工程)
 */
@Service
public class ConsuerService implements OrderService {

    //接口的真正实现在别的工程里面
    @Autowired
    private UserService userService; //面向接口

    public void initOrder(String s) {
        System.out.println("initOrder(String s) --> "+s);
        //接口的真正实现在别的工程里面
        List<UserAddress> userAddressByUserId = userService.getUserAddressByUserId(s);
        System.out.println(userAddressByUserId);
        for (UserAddress user: userAddressByUserId) {
            System.out.println(user);
        }

    }
}
